package com.bai.ad.controller;

import com.alibaba.fastjson.JSON;
import com.bai.ad.service.IUserService;
import com.bai.ad.vo.CreateUserRequest;
import com.bai.ad.vo.CreateUserResponse;
import com.bao.ad.exception.AdException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;

/**
 * ClassName UserOPController
 *
 * @author Bai
 * @version 1.0
 * @date 2019/2/24 0024 下午 13:48
 **/
@Slf4j
@Controller
public class UserOPController {

    private final IUserService userService;

    @Autowired
    public UserOPController(IUserService userService) {
        this.userService = userService;
    }

    @PostMapping(value = "/create/user")
    public CreateUserResponse createUser(
            CreateUserRequest request) throws AdException{
        log.info("ad-sponsor: createUser -> {}", JSON.toJSONString(request));
        return userService.createUser(request);
    }
}
